home *** CD-ROM | disk | FTP | other *** search
- package Local.Game.Thing
- {
- import Local.Game.World.*;
- import Local.Game.World.Map.*;
- import Local.Game.World.Map.Cell.*;
- import Local.Math.*;
- import STC9.System.*;
- import flash.display.*;
- import flash.events.*;
- import flash.geom.*;
-
- public class CAircraftCessna extends CAircraft
- {
-
-
- private var mPath:CPath;
-
- private var mTrackSoundID:String;
-
- public function CAircraftCessna(param1:CPosition)
- {
- if(true)
- {
- super(param1);
- if(true)
- {
- mType = "cessna";
- if(true)
- {
- Process = Process_Normal;
- if(true)
- {
- mAngle = new CAngle();
- if(true)
- {
- mDelta = new CPosition();
- if(true)
- {
- mMaxLife = mLife = 100;
- if(true)
- {
- mMaxSpeed = 27 * mSpriteScalar * mEnemySpeed;
- if(true)
- {
- mSpeed = mMaxSpeed;
- if(true)
- {
- mAcceleration = 1;
- }
- mOrientation = -1;
- }
- SetTargetting(650,true,FILTER_GroundTargets,true,300);
- }
- AddAnimation("stand",Cessna,"AddSprite_Scale");
- }
- SetCollisionBySprite(mAnimation[0]);
- }
- AddLoopingSound("flight",Cessna_Flight);
- }
- mTrackSoundID = PlaySound("flight");
- }
- SetState("SEARCHTARGET");
- }
- IncrementBuild();
- }
- }
-
- override public function Dispose() : void
- {
- if(mDisposed)
- {
- return;
- }
- super.Dispose();
- StopSound(mTrackSoundID);
- }
-
- public function State_SEARCHTARGET_Exit() : void
- {
- }
-
- public function State_SEARCHTARGET() : void
- {
- mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
- mPosition.Sub(mDelta);
- if((mCurrentTarget = GetTarget()) != null)
- {
- SetState("FOLLOWPATH");
- return;
- }
- }
-
- public function State_FOLLOWPATH_Enter() : void
- {
- mPath = new CPath();
- §§push(mPath);
- if(true)
- {
- §§pop().SetPath([mPosition,new Point((mPosition.x + mCurrentTarget.mPosition.x) / 2,mPosition.y),mCurrentTarget.mPosition]);
- §§push(mPath);
- }
- §§pop().OrientateThing(this);
- mMaxSpeed *= 2;
- }
-
- public function State_FOLLOWPATH_Exit() : void
- {
- }
-
- public function State_SEARCHTARGET_Enter() : void
- {
- }
-
- public function State_NOPATH() : void
- {
- mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
- mPosition.Add(mDelta);
- }
-
- override public function Draw() : void
- {
- if(true)
- {
- super.Draw();
- if(true)
- {
- mAnimationFrame += 0.25;
- GetAnimationFrame();
- }
- DrawSprite(GetOrientationMatrix());
- }
- }
-
- public function Process_Normal() : void
- {
- var _loc1_:Point = null;
- if(true)
- {
- Accelerate_Speed();
- if(true)
- {
- if(Process_State != null)
- {
- if(true)
- {
- Process_State();
- if(true)
- {
- addr27:
- mCollide.Update();
- if(true)
- {
- if(MapMove())
- {
- }
- addr36:
- if(mDisposed)
- {
- §§goto(addr38);
- }
- else
- {
- §§goto(addr39);
- }
- }
- Process_ReachedObjective();
- }
- §§goto(addr36);
- }
- addr38:
- return;
- }
- §§goto(addr27);
- }
- addr39:
- Process_Children();
- _loc1_ = OrientatePoint(mSprite.mObjects["front"].mPosition.clone(),mPosition);
- §§goto(addr41);
- }
- addr41:
- §§push(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x));
- if(true)
- {
- §§push(§§pop() || mDead);
- }
- if(§§pop())
- {
- mDead = true;
- }
- if(mDead)
- {
- AddThing(new CEffectExplosionLarge(mPosition.Clone(),250));
- DispatchDispose();
- Explode();
- }
- }
-
- override public function get mPrize() : int
- {
- return CPeepM16.mCost * 20;
- }
-
- public function State_NOPATH_Exit() : void
- {
- }
-
- public function State_NOPATH_Enter() : void
- {
- }
-
- public function State_FOLLOWPATH() : void
- {
- if(!mPath.MoveAlong(mSpeed))
- {
- mDead = true;
- return;
- }
- mPath.OrientateThing(this);
- }
-
- override public function get mBaseDamage() : Number
- {
- return 200;
- }
- }
- }
-